package com.wms.controller;

import com.wms.service.ChartService;
import com.wms.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * ---Do First---
 *
 * @author:wellseasun
 * @date:2025/5/3 下午 4:35
 * @desc:
 */
@RestController
@RequestMapping("/chart")
public class ChartController {
    @Autowired
    private ChartService chartService;

    // 返回一个id按1-10顺序对应的平台订单金额的list单列集合
    @GetMapping("/platformAmount")
    public R getChartData(){
        List<Map<String,Double>> data = chartService.getChartData();
        return R.ok(data);
    }
    // 返回每个平台的退货订单数
    // list<map<String(平台名称）,Integer(退货订单数)>>
    @GetMapping("/returnOrderNumData")
    public R getReturnOrderNumData(){
        List<Map<String,Integer>> list = chartService.getReturnOrderNumData();
        return R.ok(list);
    }

    // 返回近七天的采购订单数
    @GetMapping("/purchaseOrderNum")
    public R getPurchaseOrderNum(){
        Integer num = chartService.getPurchaseOrderNum();
        return R.ok(num);
    }

    // 返回近七天的平台订单数
    @GetMapping("/platformOrderNum")
    public R getPlatformOrderNum(){
        Integer num = chartService.getPlatformOrderNum();
        return R.ok(num);
    }
    // 返回近七天的退货订单数
    @GetMapping("/returnOrderNum")
    public R getReturnOrderNum(){
        Integer num = chartService.getReturnOrderNum();
        return R.ok(num);
    }
}
